/******************************************************************************
*	usbd/pipe.h
*	 by Alex Chadwick
*
*	A light weight implementation of the USB protocol stack fit for a simple
*	driver.
*
*	usbd/pipe.h contains definitions relating to the USB pipe structure,
*	defined as part of the USB protocol. The precise details of this data
*	structure are an implementation detail, matching Linux in this case to
*	aid compatibility.
******************************************************************************/
#ifndef _USBD_PIPE_H
#define _USBD_PIPE_H

#include <types.h>

//------------------------------------------------------------------------------
// The USB pipe
// Defined in "USB Sepcification, Rev 2.0, 27/Apr/2000" section 10.5.1
//
// The UsbPipeAddress holds the address of a pipe.
// The USB standard defines a pipe as: A software mechanism for communication
//   between the USB driver and the host controller driver.
// We have no concept of creating/destroying pipes, as it is needless clutter.
//   We simply indicate the pipe by its physical properties.
// In other words, we identify the pipe by its physical consequences on the USB.
// This is similar to Linux, and vastly reduces complication, at the expense of
//   requiring a little more sophistication on the sender's behalf.
//
typedef
	struct UsbPipeAddress {
		UsbPacketSize MaxSize   :  2;  // @0
		UsbSpeed Speed          :  2;  // @2
		unsigned EndPoint       :  4;  // @4
		unsigned Device         :  8;  // @8
		UsbTransfer Type        :  2;  // @16
		UsbDirection Direction  :  1;  // @18
		unsigned _reserved19_31 : 13;  // @19
	}
UsbPipeAddress;

#endif // _USBD_PIPE_H
